package com.iwhalecloud.bss.kite.cucc.client.dto.pos;

import com.iwhalecloud.bss.kite.cucc.client.annotation.NotNull;
import org.apache.commons.collections.MapUtils;

import java.util.Map;

public class KitePosRequestDTO {

	@NotNull(fileName="应用标识", valid=false)
	private String APP_ID;

	@NotNull(fileName="应用标识", valid=false)
	private String appId;

	@NotNull(fileName="序列号", valid=true)
	private String serialNo;

	@NotNull(fileName="来源触点", valid=true)
	private String sourceMall;

	@NotNull(fileName="来源触点名称", valid=false)
	private String sourceMallName;

	@NotNull(fileName="源订单号", valid=true)
	private String sourceOrderId;

	@NotNull(fileName="版本号", valid=true)
	private Integer version;


    @NotNull(fileName="更新方式", valid=false)
    private KitePosControlDTO control;


    public KitePosControlDTO getControl() {
        return control;
    }

    public void setControl(KitePosControlDTO control) {
        this.control = control;
    }
	public String getAPP_ID() {
		return APP_ID;
	}

	public void setAPP_ID(String aPP_ID) {
		APP_ID = aPP_ID;
	}

	public String getSerialNo() {
		return serialNo;
	}

	public void setSerialNo(String serialNo) {
		this.serialNo = serialNo;
	}

	public String getSourceMall() {
		return sourceMall;
	}

	public void setSourceMall(String sourceMall) {
		this.sourceMall = sourceMall;
	}

	public String getSourceMallName() {
		return sourceMallName;
	}

	public void setSourceMallName(String sourceMallName) {
		this.sourceMallName = sourceMallName;
	}

	public String getSourceOrderId() {
		return sourceOrderId;
	}

	public void setSourceOrderId(String sourceOrderId) {
		this.sourceOrderId = sourceOrderId;
	}

	public Integer getVersion() {
		return 1;
	}

	public void setVersion(Integer version) {
		this.version = version;
	}

	public String getAppId() {
		return appId;
	}

	public void setAppId(String appId) {
		this.appId = appId;
	}

    public KitePosRequestDTO() {
    }

    public KitePosRequestDTO(String APP_ID, String appId, String serialNo, String sourceMall, String sourceMallName, String sourceOrderId, Integer version) {
        this.APP_ID = APP_ID;
        this.appId = appId;
        this.serialNo = serialNo;
        this.sourceMall = sourceMall;
        this.sourceMallName = sourceMallName;
        this.sourceOrderId = sourceOrderId;
        this.version = version;
    }

    // 订单详情返回报文 request 节点转 KitePosRequestDTO
    public KitePosRequestDTO(Map<String, Object> request) {
        this.APP_ID = MapUtils.getString(request, "APP_ID");
        this.appId = MapUtils.getString(request, "APP_ID");
        this.serialNo = MapUtils.getString(request, "SERIAL_NO");
        this.sourceMall = MapUtils.getString(request, "SOURCE_MALL");
        this.sourceMallName = MapUtils.getString(request, "SOURCE_MALL_NAME");
        this.sourceOrderId = MapUtils.getString(request, "SOURCE_ORDER_ID");
        this.version = MapUtils.getInteger(request, "VERSION");
    }
}
